<html>
<head><meta charset="utf-8"><title>stability flags · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html">stability flags</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="204987336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204987336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Griffiths <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204987336">(Jul 25 2020 at 04:18)</a>:</h4>
<p>Hi there. I'm currently working on issue <a href="https://github.com/rust-lang/rust/issues/60302">#60302</a>, cleaning up some of the longer files in the compiler code. </p>
<p>I think I'm making some okay progress (albeit slowly - sorry). I've come across a build error about stability flags. I had a quick read about the stability process and I had a few questions. I'm currently just extracting various structs and impl blocks that I think  (I am not sure if anything I'm doing is correct, I guess I'll find out during the pull request phase?) can be kept in their own modules while still trying to keep them related to their original file. Some of these structs that I'm putting into their own modules are throwing errors like this: <code>error: field has missing stability attribute</code>.</p>
<p>How should I proceed with these errors. Is there a flag I can add to ignore this (would I even want to ignore this) or do I need to go through the process of adding the stability attribute? After all these aren't really new features. I've just copied and pasted some code into new files.</p>



<a name="204997831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204997831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204997831">(Jul 25 2020 at 10:07)</a>:</h4>
<p><span class="user-mention" data-user-id="324997">@Alex Griffiths</span> it would help if you could give an example of the errors. Maybe some of these fields are being  explicitly whitelisted elsewhere?</p>



<a name="204998004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Griffiths <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998004">(Jul 25 2020 at 10:12)</a>:</h4>
<p>Sure thing. Give me a sec.</p>



<a name="204998123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Griffiths <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998123">(Jul 25 2020 at 10:17)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error: field has missing stability attribute
 --&gt; src/libcore/str/utf8.rs:6:5
  |
6 |     pub valid_up_to: usize,
  |     ^^^^^^^^^^^^^^^^^^^^^^

error: field has missing stability attribute
 --&gt; src/libcore/str/utf8.rs:7:5
  |
7 |     pub error_len: Option&lt;u8&gt;,
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^
</code></pre></div>


<p>Then the struct in <a href="http://utf8.rs">utf8.rs</a></p>
<div class="codehilite"><pre><span></span><code>pub struct Utf8Error {
    pub valid_up_to: usize,
    pub error_len: Option&lt;u8&gt;,
}
</code></pre></div>


<p>The Utf8Error struct is included in the libcore/str/mod.rs</p>



<a name="204998167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Griffiths <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998167">(Jul 25 2020 at 10:18)</a>:</h4>
<p>Oh also, sorry, since I directly cut this struct out of the <a href="http://mod.rs">mod.rs</a> file as well,</p>



<a name="204998171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Griffiths <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998171">(Jul 25 2020 at 10:18)</a>:</h4>
<p>Above it is the flag <code>#[stable(feature = "rust1", since="1.0.0")]</code></p>



<a name="204998228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998228">(Jul 25 2020 at 10:20)</a>:</h4>
<p>can you push your commits to github?</p>



<a name="204998231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998231">(Jul 25 2020 at 10:20)</a>:</h4>
<p>even if they are failing rn, I think I know the problem here but am not completely sure yet</p>



<a name="204998238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Griffiths <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998238">(Jul 25 2020 at 10:21)</a>:</h4>
<p>Sure thing. One moment. Takes my computer a while to handle this repo apparently.</p>



<a name="204998475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Griffiths <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998475">(Jul 25 2020 at 10:28)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> <a href="https://github.com/alex-griffiths/rust/commit/bdbfb4b6de73567ff0b57da9959dfafb4d2c51de">https://github.com/alex-griffiths/rust/commit/bdbfb4b6de73567ff0b57da9959dfafb4d2c51de</a></p>



<a name="204998483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998483">(Jul 25 2020 at 10:29)</a>:</h4>
<p>yeha, so you now export the fields of drain here</p>



<a name="204998487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998487">(Jul 25 2020 at 10:29)</a>:</h4>
<p>by adding <code>pub</code> to the fields</p>



<a name="204998529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998529">(Jul 25 2020 at 10:30)</a>:</h4>
<p>You probably can fix this by either using <code>pub(super)</code></p>



<a name="204998535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998535">(Jul 25 2020 at 10:30)</a>:</h4>
<p>or adding a <code>pub(super)</code> constructor to <code>Drain</code> and keep the fields private, which is probably the best solution imo</p>



<a name="204998545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Griffiths <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998545">(Jul 25 2020 at 10:31)</a>:</h4>
<p>And so I should do that in <code>Utf8Error</code> and <code>CharIndices</code> right?</p>



<a name="204998547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998547">(Jul 25 2020 at 10:31)</a>:</h4>
<p>yeah, the same there</p>



<a name="204998597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Griffiths <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998597">(Jul 25 2020 at 10:33)</a>:</h4>
<p>I don't know if you've looked at the issue I'm working on at the moment, but would you be able to give me a quick yes or no to let me know if I'm heading in the right direction with what I'm doing right now?</p>



<a name="204998599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998599">(Jul 25 2020 at 10:33)</a>:</h4>
<p>This is pretty much what you've done here:</p>
<div class="codehilite"><pre><span></span><code><span class="k">mod</span> <span class="nn">outer</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">field</span>: <span class="kt">u8</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">mod</span> <span class="nn">new_outer</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">mod</span> <span class="nn">inner</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="k">pub</span><span class="w"> </span><span class="n">field</span>: <span class="kt">u8</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">use</span><span class="w"> </span><span class="n">inner</span>::<span class="n">Foo</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">// outer::Foo { field: 7 };</span>
<span class="w">    </span><span class="c1">// ^ this fails</span>
<span class="w">    </span><span class="n">new_outer</span>::<span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">field</span>: <span class="mi">7</span><span class="w"> </span><span class="p">};</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="204998655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998655">(Jul 25 2020 at 10:35)</a>:</h4>
<p>Yeah, I think moving the iterators and stuff into a separate module/file is a good idea.</p>
<p>Somewhat ambivalent about <code>str/utf8</code> as it's a fairly small module, but I think that's also not a bad change.</p>



<a name="204998695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/stability%20flags/near/204998695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/stability.20flags.html#204998695">(Jul 25 2020 at 10:36)</a>:</h4>
<p>So what you are doing looks right to me <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>